Help on SEDOL to RIC Conversion

API - EIkon

Language - Python

Environment - Windows

I converted some 5000 stocks SEDOLS into RIC. I got all the RIC. Named it RIC1

ric1=pd.DataFrame(ek.get_symbology(sedols1, from_symbol_type='SEDOL', to_symbol_type=['RIC']))


Than I converted all the RIC into string by the function……. list3=ric1["RIC"].astype(str).tolist().

Print( list3)

All the RICs came on screen.


Than ran the function . & got the below error


ek.get_timeseries('list3',
fields='CLOSE',
start_date='2024-08-21',
end_date='2024-08-22')


image002-3.png

Answers

  • @Sachin Murthy S K

    Thank you for reaching out to us.

    The code should be like this:

    ek.get_timeseries(list3,
       fields='CLOSE',
       start_date='2024-08-21',
       end_date='2024-08-22')

    The get_timeseries method has limitations. Please check the Eikon Data API Usage and Limits Guideline.

    You can use the LSEG Data Library for Python instead. The examples are on GitHub.

  • hello @Jirapongse

    Thank you for your reply. The data is too large. how do I get API in batches?

    What command can i use better. I used the below command it did not work.

    1725365586242.png

  • just to add i am getting ' time series request failed' getting error eikon code -1


    1725365810245.png

  • @rupa

    You may need to break an array into chunks. Please check this website.

    I suggest to use the LSEG Data Library for Python instead. The examples are on GitHub.

  • hello @Jirapongse

    Thank you for your reply. The data is too large. how do I get API in batches?

    What command can i use better. I used the below command it did not work.

    image

    just to add i am getting ' time series request failed' getting error eikon code -1


    image

  • HI Jason,

    will the below help to break

    def batch(iterable:Iterable,max_batch_size:Int):

    batch=[]

    for element in iterable:

    batch.append(element)

    if len(batch)>=max_batch_size:

    yield batch

    batch =[]

    if len(batch)>0:

    yield batch

  • The code could be like this:

    instruments = ['EQNR.OL' ,'DNB.OL' ,'NHY.OL' ,...]
     
    def split_instruments(instruments, chunk_size=5):
        """Yield successive chunk_size chunks from instruments."""
        for i in range(0, len(instruments), chunk_size):
            yield instruments[i:i + chunk_size]
     
    instrument_chunks = list(split_instruments(instruments))
    for chunk in instrument_chunks:
    data = ek.get_timeseries(chunk, ...)

  • Hi Jason,

    I broke into chunks of 100's. All those chunks were stored in variable 'gen'. After than I ran the final function & got this error. What could this be? Thanks

    1725536545846.png

  • Hi Jason,


    I was able to get output in those batches.. thank you v much.

    Output is in a dataframe with close price of say day 25th & day 24th. 3200 stocks,

    how would you calculate daily return of stocks from that data frame & get returns as an additional column?



    Thanks

    R